package com.qcby.pushservice.web.controller;

import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 卡夫卡测试控制器
 *
 * @author cong.zhen
 * @date 2023/05/15
 */
@RestController
public class KafkaTestController {

    @Resource
    private KafkaTemplate<String,String> kafkaTemplate;

    @GetMapping("/test")
    public String testKafka(){
        String message = "hello";
        kafkaTemplate.send("test",message);
        return message;

    }
}
